﻿@page "/users/{userId}/edit"
@using Microsoft.AspNetCore.Authorization

@attribute [Authorize]

<MudText Typo="Typo.h4" Class="mb-8">Benutzer bearbeiten</MudText>

<MudForm Model="@user" @ref="@_form">
    <MudGrid>
        <MudItem xs="6">

            <MudTextField @bind-Value="user.Email" For="@(() => user.Email)"
                          Label="E-Mail"
                          Required="true"
                          Variant="Variant.Text"
                          InputType="InputType.Email"
                          Class="mt-6">
            </MudTextField>

            <MudTextField @bind-Value="user.Firstname" For="@(() => user.Firstname)"
                          Label="Vorname"
                          Required="true"
                          Variant="Variant.Text"
                          InputType="InputType.Text"
                          Class="mt-6">
            </MudTextField>

            <MudTextField @bind-Value="user.Lastname" For="@(() => user.Lastname)"
                          Label="Nachname"
                          Required="true"
                          Variant="Variant.Text"
                          InputType="InputType.Text"
                          Class="mt-6">
            </MudTextField>

            <MudTextField @bind-Value="user.Password" For="@(() => user.Password)"
                          Label="Passwort"
                          Required="true"
                          Variant="Variant.Text"
                          InputType="InputType.Password"
                          Class="mt-6">
            </MudTextField>

            <MudTextField @bind-Value="user.PasswordConfirm" For="@(() => user.PasswordConfirm)"
                          Label="Passwort bestätigen"
                          Required="true"
                          Variant="Variant.Text"
                          InputType="InputType.Password"
                          Class="mt-6">
            </MudTextField>

            <MudButton Variant="Variant.Filled"
                       Color="Color.Primary"
                       Size="Size.Large"
                       ButtonType="ButtonType.Button"
                       OnClick="@(Save)"
                       Class="mt-6">Speichern</MudButton>
        </MudItem>
    </MudGrid>
</MudForm>